package br.com.gerenciadoc.mb;

import javax.faces.context.FacesContext;

public class MBPageViewIdGenerator {

    private String includedPage = "/home.xhtml";

    public String sideBarAction() {
        /**
         * Pega o id do link que sofreu o click
         */
        FacesContext context = FacesContext.getCurrentInstance();
        String selectedPageViewId =
                context.getExternalContext().getRequestParameterMap().get("pageViewId");

        if (selectedPageViewId.equalsIgnoreCase("page1")) {
            includedPage = "/cadastroUsuario.xhtml";
        } else if (selectedPageViewId.equalsIgnoreCase("page2")) {
            includedPage = "/uploadDocumentos.xhtml";
        } else if (selectedPageViewId.equalsIgnoreCase("page3")) {
            includedPage = "/downloadDocumentos.xhtml";
        } else if (selectedPageViewId.equalsIgnoreCase("page4")) {
            includedPage = "/login.xhtml";
        }
        return "";
    }

    /**
     * @return the includedPage
     */
    public String getIncludedPage() {
        return includedPage;
    }

    /**
     * @param includedPage the includedPage to set
     */
    public void setIncludedPage(String includedPage) {
        this.includedPage = includedPage;
    }
}